#!/bin/sh

#######################ping telnet
if ping -c 3 www.baidu.com >/dev/null 2>&1;
then 
echo yes
tping=1



else echo no
fi

#if telnet www.baidu.com 80 |grep "Connected to www.baidu.com.">/dev/null 2>&1;
a=`echo ""|telnet www.baidu.com 80 2>/dev/null|grep "Connected to www.baidu.com."|wc -l`
if [ $a -gt 0 ];then
echo yes
ttelnet=1
else
echo no
fi 

if [ $tping==1 ]&&[ $ttelnet==1 ];then 
echo "ping and telnet www.baidu.com is all ok!"
else
echo "ping or telnet www.baidu.com is not ok"
fi
